package lab02.test06;

/**
 * Created by dell on 2017/10/15.
 */
public class Triangle {
    //构造函数
   Triangle(){}

    //属性：Triangle类具有类型为double的三个边，以及周长、面积属性，
    // 属性：Triangle类还具有一个Boolean型的属性，
    double side1;
    double side2;
    double side3;
    double perimeter;
    double area;
    boolean Triangle;

    // 行为：Triangle类具有返回周长、面积以及修改三个边的功能。该属性用来判断三个属能否构成一个三角形
    void set(double side1, double side2, double side3ide) {
        this.side1 = side1;
        this.side2 = side2;
        this.side3 = side3;
    if((side1+side2>side3)&&(side1+side3>side2)&&(side2+side3>side1))
        System.out.println(Triangle = true);
    else
        System.out.println(Triangle = false);
    }

    public void setSide1(double side1) {
        this.side1 = side1;
    }

    public void setSide2(double side2) {
        this.side2 = side2;
    }

    public void setSide3(double side3) {
        this.side3 = side3;
    }

    public void setTriangle(boolean triangle) {
        Triangle = triangle;
    }

    public double getSide1() {
        return side1;
    }

    public double getSide2() {
        return side2;
    }

    public double getSide3() {
        return side3;
    }

    public boolean isTriangle() {
        return Triangle;
    }

    public void getArea(double area) {
        this.area = area;
    }
    double Perimeter() {
        perimeter = side1 + side2 + side3;
        return perimeter;
    }

    //面积
    double area() {
        double p;
        p = (side1 + side2 + side3) / 2;
        area = Math.sqrt(p * (p - side1) * (p - side2) * (p - side3));
        return area;
    }

    public static void main(String[] args) {

    }
}
